package org.neuedu.chapter10_0702.demo03;

import java.util.ArrayList;
import java.util.List;

public class ListDemo02 {

    public List<Student> getList() {
        Student s1 = new Student("tom", 111, 22);
        Student s2 = new Student("lucy", 110, 22);
        Student s3 = new Student("ella", 119, 22);
        Student s4 = new Student("allen", 121, 22);
        Student s5 = new Student("mike", 123, 22);

        List<Student> list = new ArrayList<>();
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);

        return list;
    }

    public static void main(String[] args) {
        ListDemo02 d = new ListDemo02();
        List<Student> list = d.getList();
        for (Student student : list) {
            System.out.println(student.getUsername());
        }
    }
}
